home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / dev / sun4.md / devFsOpTable.c < prev    next >
C/C++ Source or Header  |  1990-10-19  |  5KB  |  173 lines

  1. /* 
  2.  * devFsOpTable.c --
  3.  *
  4.  *    The operation tables for the file system devices on Sun-4 hosts.
  5.  *
  6.  * Copyright 1987, 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/kernel/dev/sun4.md/RCS/devFsOpTable.c,v 9.2 90/10/19 15:39:47 mgbaker Exp $ SPRITE (Berkeley)";
  18. #endif not lint
  19.  
  20.  
  21. #include "sprite.h"
  22. #include "dev.h"
  23. #include "devInt.h"
  24. #include "fs.h"
  25. #include "rawBlockDev.h"
  26. #include "devFsOpTable.h"
  27. #include "devTypes.h"
  28.  
  29. /*
  30.  * Device specific include files.
  31.  */
  32.  
  33. #include "devSyslog.h"
  34. #include "devNull.h"
  35. #include "devSCSIDisk.h"
  36. #include "devSCSITape.h"
  37. #include "xylogics450.h"
  38. #include "devNet.h"
  39. #include "devBlockDevice.h"
  40. #include "scsiHBADevice.h"
  41. #include "raidExt.h"
  42. #include "tty.h"
  43. #include "mouse.h"
  44. #include "devTMR.h"
  45. #include "devfb.h"
  46.  
  47. static ReturnStatus NoDevice();
  48. static ReturnStatus NullProc();
  49.  
  50.  
  51. /*
  52.  * Device type specific routine table:
  53.  *    This is for the file-like operations as they apply to devices.
  54.  *    DeviceOpen
  55.  *    DeviceRead
  56.  *    DeviceWrite
  57.  *    DeviceIOControl
  58.  *    DeviceClose
  59.  *    DeviceSelect
  60.  *    BlockDeviceAttach
  61.  *    DeviceReopen
  62.  *    DeviceMmap
  63.  */
  64.  
  65.  
  66. DevFsTypeOps devFsOpTable[] = {
  67.     /*
  68.      * Serial lines used to implement terminals.
  69.      */
  70.     {DEV_TERM,       DevTtyOpen, DevTtyRead, DevTtyWrite,
  71.              DevTtyIOControl, DevTtyClose, DevTtySelect,
  72.              DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  73.     /*
  74.      * The system error log.  If this is not open then error messages go
  75.      * to the console.
  76.      */
  77.     {DEV_SYSLOG,    Dev_SyslogOpen, Dev_SyslogRead, Dev_SyslogWrite,
  78.             Dev_SyslogIOControl, Dev_SyslogClose, Dev_SyslogSelect,
  79.             DEV_NO_ATTACH_PROC, Dev_SyslogReopen, NullProc},
  80.     /*
  81.      * SCSI Worm interface:  this device doesn't exist anymore.
  82.      */
  83.     {DEV_SCSI_WORM, Dev_TimerOpen, Dev_TimerRead, NullProc,
  84.                     Dev_TimerIOControl, NullProc, NullProc,
  85.                     DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  86.     /*
  87.      * The following device number is unused.
  88.      */
  89.     {DEV_PLACEHOLDER_2, NoDevice, NullProc, NullProc,
  90.             Dev_NullIOControl, NullProc, NullProc,
  91.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  92.     /*
  93.      * New SCSI Disk interface.
  94.      */
  95.     {DEV_SCSI_DISK, DevRawBlockDevOpen, DevRawBlockDevRead,
  96.             DevRawBlockDevWrite, DevRawBlockDevIOControl, 
  97.             DevRawBlockDevClose, NullProc, DevScsiDiskAttach,
  98.             DevRawBlockDevReopen, NullProc},
  99.     /*
  100.      * SCSI Tape interface.
  101.      */
  102.     {DEV_SCSI_TAPE, DevSCSITapeOpen, DevSCSITapeRead, DevSCSITapeWrite,
  103.             DevSCSITapeIOControl, DevSCSITapeClose, NullProc,
  104.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  105.     /*
  106.      * /dev/null
  107.      */
  108.     {DEV_MEMORY,    NullProc, Dev_NullRead, Dev_NullWrite,
  109.             Dev_NullIOControl, NullProc, Dev_NullSelect,
  110.             DEV_NO_ATTACH_PROC, NullProc, NullProc},
  111.     /*
  112.      * Xylogics 450 disk controller.
  113.      */
  114.     {DEV_XYLOGICS, DevRawBlockDevOpen, DevRawBlockDevRead,
  115.             DevRawBlockDevWrite, DevRawBlockDevIOControl, 
  116.             DevRawBlockDevClose, NullProc, DevXylogics450DiskAttach,
  117.             DevRawBlockDevReopen, NullProc},
  118.     /*
  119.      * Network devices.  The unit number specifies the ethernet protocol number.
  120.      */
  121.     {DEV_NET,      DevNet_FsOpen, DevNet_FsRead, DevNet_FsWrite, 
  122.            DevNet_FsIOControl, DevNet_FsClose, DevNet_FsSelect, 
  123.            DEV_NO_ATTACH_PROC, DevNet_FsReopen, NullProc},
  124.     /*
  125.      * Raw SCSI HBA interface.
  126.      */
  127.     {DEV_SCSI_HBA, DevSCSIDeviceOpen, Dev_NullRead, Dev_NullWrite,
  128.             DevSCSIDeviceIOControl, DevSCSIDeviceClose, Dev_NullSelect,
  129.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  130.     /*  
  131.      * RAID device.
  132.      */ 
  133.     {DEV_RAID, DevRawBlockDevOpen, DevRawBlockDevRead,
  134.                     DevRawBlockDevWrite, DevRawBlockDevIOControl,
  135.                     DevRawBlockDevClose, NullProc, DevRaidAttach,
  136.                     DevRawBlockDevReopen, NullProc},
  137.     /*  
  138.      * Debug device. (useful for debugging RAID device)
  139.      */ 
  140.     {DEV_DEBUG, DevRawBlockDevOpen, DevRawBlockDevRead,
  141.                     DevRawBlockDevWrite, DevRawBlockDevIOControl,
  142.                     DevRawBlockDevClose, NullProc, DevDebugAttach,
  143.                     DevRawBlockDevReopen, NullProc},
  144.     /*
  145.      * Event devices for window systems.
  146.      */
  147.     {DEV_MOUSE,    DevMouseOpen, DevMouseRead, DevMouseWrite,
  148.            DevMouseIOControl, DevMouseClose, DevMouseSelect,
  149.            DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  150.     /*
  151.      * Frame buffer device.
  152.      */
  153.     {DEV_GRAPHICS, DevFBOpen, NullProc, NullProc,
  154.                    DevFBIOControl, DevFBClose, NullProc,
  155.                    DEV_NO_ATTACH_PROC, NoDevice, DevFBMMap},
  156.  
  157. };
  158.  
  159. int devNumDevices = sizeof(devFsOpTable) / sizeof(DevFsTypeOps);
  160.  
  161. static ReturnStatus
  162. NullProc()
  163. {
  164.     return(SUCCESS);
  165. }
  166.  
  167.  
  168. static ReturnStatus
  169. NoDevice()
  170. {
  171.     return(FS_INVALID_ARG);
  172. }
  173.